From: Gerd Moellmann Date: Thu, 17 May 2001 13:55:33 +0000 (+0000) Subject: (elp-instrument-function): Handle advised X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1~1^2~40253 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=179d5af2304f05db2d8bfded9318ae5c35416435;p=emacs.git (elp-instrument-function): Handle advised functions. --- diff --git a/lisp/emacs-lisp/elp.el b/lisp/emacs-lisp/elp.el index af189126a09..6ecb05b231f 100644 --- a/lisp/emacs-lisp/elp.el +++ b/lisp/emacs-lisp/elp.el @@ -1,6 +1,6 @@ ;;; elp.el --- Emacs Lisp Profiler -;; Copyright (C) 1994,1995,1997,1998 Free Software Foundation, Inc. +;; Copyright (C) 1994,1995,1997,1998, 2001 Free Software Foundation, Inc. ;; Author: 1994-1998 Barry A. Warsaw ;; Maintainer: FSF @@ -266,15 +266,22 @@ FUNSYM must be a symbol of a defined function." ;; put the info vector on the property list (put funsym elp-timer-info-property infovec) - ;; set the symbol's new profiling function definition to run - ;; elp-wrapper - (fset funsym newguts) + ;; Set the symbol's new profiling function definition to run + ;; elp-wrapper. + (let ((advice-info (get funsym 'ad-advice-info))) + (if advice-info + (progn + ;; If function is advised, don't let Advice change + ;; its definition from under us during the `fset'. + (put funsym 'ad-advice-info nil) + (fset funsym newguts) + (put funsym 'ad-advice-info advice-info)) + (fset funsym newguts))) ;; add this function to the instrumentation list (or (memq funsym elp-all-instrumented-list) (setq elp-all-instrumented-list - (cons funsym elp-all-instrumented-list))) - )) + (cons funsym elp-all-instrumented-list))))) (defun elp-restore-function (funsym) "Restore an instrumented function to its original definition.